// Copyright (C) 2005 - 2009 rubicon informationstechnologie gmbh
// All rights reserved.
//
using System;
using System.IO;
using System.Reflection;
using Mono.Cecil;

namespace AssemblyTransformer.UnitTests
{
  public static class AssemblyNameReferenceObjectMother
  {
    public static readonly byte[] PublicKeyToken1 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89 };
    public static readonly byte[] PublicKeyToken2 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x90 };
    public static readonly byte[] PublicKeyToken3 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x91 };
    public static readonly byte[] PublicKeyToken4 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x92 };
    public static readonly byte[] PublicKeyToken5 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x93 };

    public static readonly byte[] PublicKey1 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x00 };
    public static readonly byte[] PublicKey2 = new byte[] { 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x90, 0x00 };

    private static StrongNameKeyPair _keyPair = new StrongNameKeyPair(new byte[] {
0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xd3, 0x34, 0x8e, 0x15, 0x80, 0xb0, 0x2a, 0xc1, 0x7f, 0x7a,
0xe4, 0x6e, 0x9c, 0x8e, 0xc9, 0x44, 0x6d, 0x3c, 0xf8, 0xd5, 0x7c, 0x78, 0x28, 0x50, 0x81, 0x52, 0x6a, 0x5d, 0x99, 0x19, 0x99, 0xe5, 0xdb, 0x61, 0xdd, 0xfc, 0x94, 0x5b, 0xe6, 0x00,
0x97, 0x6b, 0x96, 0xd6, 0x69,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b7, 0xb2, 0x04, 0xab, 0x79, 0xc7, 0x7e, 0xe7, 0x98, 0xba, 0x60, 0x3b, 0x67, 0x6f,
0xf4, 0x5c, 0xcc, 0x83, 0xf3, 0x0c, 0x02, 0xaa, 0xa7, 0xed, 0xbc, 0x65, 0xfe, 0x8a, 0x3f, 0xff, 0xb0, 0x5d, 0xe1, 0xcd, 0xdf, 0xcf, 0x70, 0x60, 0xe6, 0x52, 0xfd, 0x34, 0x72, 0xd8,
0x79, 0x88, 0xf7, 0xda, 0xd2, 0xdf, 0x7f, 0x27, 0x5c, 0x4a, 0x53, 0xa1, 0x6c, 0x2d, 0xb4, 0x32, 0xe3, 0x99, 0xc8, 0x0c, 0x81, 0xa2, 0x85, 0x16, 0x9c, 0x9e, 0xd1, 0xbd, 0xd6, 0x18,
0x25, 0xf9, 0x6c, 0xe9, 0x13, 0x84, 0xfb, 0x26, 0x21, 0xb3, 0x45, 0xc5, 0x32, 0x8e, 0xd2, 0xaa, 0xfc, 0xca, 0x62, 0x09, 0x3b, 0x25, 0x46, 0xd6, 0x22, 0x74, 0xda, 0x81, 0x20, 0x75,
0x1e, 0x37, 0xe1, 0x01, 0x37, 0x7e, 0xf7, 0x6f, 0x5b, 0x8d, 0x6b, 0x94, 0x49, 0x1b, 0x84, 0xea, 0xc3, 0x14, 0xc8, 0x3c, 0x0d, 0x67, 0xcd, 0x70, 0xf8, 0x88, 0x87, 0x8e, 0x08, 0xf0,
0x0c, 0x00, 0x44, 0xb1, 0x14, 0x8b, 0xf6, 0x38, 0x42, 0x64, 0x26, 0xd0, 0xba, 0xf0, 0xde, 0xff, 0x8a, 0xf4, 0x79, 0x70, 0x19, 0x70, 0x2c, 0xbc, 0x7c, 0x28, });

    public static StrongNameKeyPair RealKeyPair ()
    {
      return _keyPair;
    }

    public static FileStream RealKeyPairStream ()
    {
        return File.Open (Path.Combine (AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\..\prereq\testing\key.snk"), FileMode.Open, FileAccess.Read, FileShare.Read);
    }

    public static AssemblyNameReference CreateAssemblyNameReference (string shortName)
    {
      return new AssemblyNameReference (shortName, null);
    }

    public static AssemblyNameReference CreateAssemblyNameReferenceWithCulture (string shortName, string culture)
    {
      return new AssemblyNameReference (shortName, null) { Culture = culture };
    }

    public static AssemblyNameReference CreateAssemblyNameReferenceWithPublicKeyToken (string shortName, byte[] publicKeyToken)
    {
      return new AssemblyNameReference (shortName, null) { PublicKeyToken = publicKeyToken };
    }

    public static AssemblyNameReference CreateAssemblyNameReferenceWithPublicKey (string shortName, byte[] publicKey)
    {
      return new AssemblyNameReference (shortName, null) { PublicKey = publicKey, HasPublicKey = true};
    }

    public static AssemblyNameReference CreateAssemblyNameReferenceWithVersion (string shortName, string version)
    {
      return new AssemblyNameReference (shortName, new Version (version));
    }
  }
}